package com.zuorenke.mybatis;

import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import javax.sql.DataSource;

/**
 * @author Z.R.K
 * @description
 * @create 2019-04-08 10:39:33
 **/
@Configuration
@MapperScan(value = "com.zuorenke.db.mybatis")
public class MybatisConfig {
	@Resource
	private DataSource dataSource;
	
	@Bean
	public SqlSessionFactoryBean sqlSessionFactory() {
		SqlSessionFactoryBean factory = new SqlSessionFactoryBean();
		factory.setDataSource(dataSource);
		return factory;
	}
}
